package ten.test_10_10;

import java.util.Scanner;

public class TestMain1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        int count = 0;
        while (n > 0) {
           if(isOk(n)) {
               n = n - (n / 3 + 1);
           } else {
               n = n - (n / 2 + 1);
           }
            count++;
        }
        System.out.println(count);
    }
    public static boolean isOk(long n) {
        for (int i = 2; i <= n / 2; i++) {
            if(n % i == 0) {
                return false;
            }
        }
        return true;
    }
}
